/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-11-24 22:18:20  
 * Copyright (c) 2015- joysuch-版权所有     
 */
package com.joysuch.wwyt.risk.service.impl;

import javax.transaction.Transactional;

import com.joysuch.wwyt.core.service.BizCodeGeneratorFacade;
import com.joysuch.wwyt.risk.entity.RiskPointEvaluationSclItem;
import com.joysuch.wwyt.risk.repository.RiskPointEvaluationSclItemDao;
import com.joysuch.wwyt.risk.service.RiskPointEvaluationSclItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
@Transactional
public class RiskPointEvaluationSclItemServiceImpl implements RiskPointEvaluationSclItemService {

    @Autowired
    private RiskPointEvaluationSclItemDao dao;
    @Autowired
    private BizCodeGeneratorFacade bizCodeGeneratorFacade;

    @Override
    public void add(RiskPointEvaluationSclItem entity) throws Exception {
        dao.save(entity);
    }

    @Override
    public void update(RiskPointEvaluationSclItem entity) throws Exception {
        RiskPointEvaluationSclItem content = dao.findById(entity.getId()).get();
        if (content != null) {
            //TODO set nessessary properties
            dao.save(entity);
        }
    }

    @Override
    public Page<RiskPointEvaluationSclItem> findByPage(Pageable page) {
        return dao.findAll(page);
    }

    @Override
    public void delete(Long id) {
        dao.deleteById(id);
    }
    
    @Override
    public RiskPointEvaluationSclItem findById(Long id) {
        return dao.findById(id).get();
    }


}
